<?php

if(isset($_REQUEST['offset'])){
	$v_offset=$_REQUEST['offset'];
}
else
	$v_offset=1;
	
$v_limit = CONST_LIMIT_AF_PAGE ;
if(isset($_REQUEST['page'])){
	$page=$_REQUEST['page'];
}
else
	$page=1;
/////////////////////////////////////////////////////////////////////////

$v_filter = '';
if(isset($_REQUEST['filter'])){
	$v_filter = $_REQUEST['filter'];
}

$v_status = 2;

if(_is_sqlserver()){
$v_table = '';
$v_column = '';
	$cmd = @mssql_init("ONEGATE_AF_FTS_ALL_SEARCH", $conn);
	@mssql_bind($cmd, "@p_filter", $v_filter, SQLVARCHAR);
	@mssql_bind($cmd, "@p_status", $v_status, SQLINT4);
	@mssql_bind($cmd, "@pTable", $v_table, SQLVARCHAR);
	@mssql_bind($cmd, "@pColumn", $v_column, SQLVARCHAR);
	$result = @mssql_execute($cmd);
	$arr_result = _get_row_to_array($result); 
	@mssql_free_result($result);	
	$v_total_af_count = $arr_result[0][0];

//echo "status".$v_status.","."me".$v_method.","."fi".$v_filter.","."agen".$v_agency_id.","."cate".$v_cate_id.",".$v_date_start.$v_date_end;

	$pager  = Pager::getPagerData($v_total_af_count, $v_limit, $page);
	$page   = $pager->page;
  	$offset = $pager->offset +1; 
  	$limit = $pager->limit;
	
	$cmd = @mssql_init("ONEGATE_AF_FTS_SEARCH", $conn);
	@mssql_bind($cmd, "@p_filter", $v_filter, SQLVARCHAR);
	@mssql_bind($cmd, "@p_status", $v_status, SQLINT4);
	@mssql_bind($cmd,"@offset", $offset,SQLINT4);	
	@mssql_bind($cmd,"@limit",$limit,SQLINT4);	
	$result = @mssql_execute($cmd);	
	@mssql_next_result($result);
	$arr_af = _get_row_to_array($result);
	$v_num_af=sizeof($arr_af);
	@mssql_free_result($result);


}
?>